package com.up.kafka.productor;

import com.up.kafka.utils.HeaderKey;
import org.apache.kafka.common.header.Header;
import org.apache.kafka.common.header.Headers;
import org.apache.kafka.common.header.internals.RecordHeader;
import org.apache.kafka.common.header.internals.RecordHeaders;
import org.springframework.kafka.core.KafkaTemplate;

/**
 * @author: baiMl
 * @title: ByteArrayMessageProducer
 * @projectName: 海联技术中台V2.0
 * @depart 软件事业部
 * @description:
 * @date: 2022/4/24 14:14
 */
public class ByteArrayMessageProducer extends AbstractMessageProducer<byte[]>{


    public ByteArrayMessageProducer(KafkaTemplate<String, byte[]> kafkaTemplate) {
        super(kafkaTemplate);
    }

    @Override
    protected Headers getHeaders() {
        Header header = new RecordHeader(HeaderKey.HEADER_DATA_PACKET_TYPE,new byte[]{HeaderKey.BYTE_ARRAY_VALUE});
        Headers headers =new RecordHeaders();
        headers.add(header);
        return headers;
    }


}
